package com.itheima_02;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileInputStreamDemo01 {
    public static void main(String[] args) throws IOException {
//        创建字节输入流对象
        FileInputStream fis = new FileInputStream("myByteStream\\fos.txt");

//        调用字节输入流对象的读数据方法
//        int by = fis.read();
//        System.out.println(by);
//        System.out.println((char)by);

        /*
        int by = fis.read();
        while (by != -1){
            System.out.print((char)by);
            by = fis.read();
        }
        */

//        优化上面的代码
        int by;
        while ((by=fis.read())!=-1){
            System.out.println((char)by);
        }

//        释放资源
        fis.close();


    }
}
